<html>
<head><meta charset="utf-8"><title>error building RLS · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/error.20building.20RLS.html">error building RLS</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="232525766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/error%20building%20RLS/near/232525766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/error.20building.20RLS.html#232525766">(Mar 31 2021 at 02:11)</a>:</h4>
<p>I'm trying to build RLS to make a small contribution, but I'm getting an error:</p>
<div class="codehilite"><pre><span></span><code>error: environment variable `CFG_RELEASE` not defined
   --&gt; /Users/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-ap-rustc_attr-705.0.0/src/builtin.rs:589:47
    |
589 |             let rustc_version = parse_version(env!(&quot;CFG_RELEASE&quot;), true).unwrap();
    |                                               ^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

error: could not compile `rustc-ap-rustc_attr`
</code></pre></div>
<p>I tried both <code>cargo run -- --cli</code> and <code>cargo run --release -- --cli</code>. I didn't see anything about a <code>CFG_RELEASE</code> environment variable in <code>contributing.md</code>. How do I fix this error?</p>



<a name="232525865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/error%20building%20RLS/near/232525865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/error.20building.20RLS.html#232525865">(Mar 31 2021 at 02:12)</a>:</h4>
<p>Aha, it's a rustfmt thing. The rustfmt repo suggests:</p>
<div class="codehilite"><pre><span></span><code>export CFG_RELEASE=1.45.0-nightly
export CFG_RELEASE_CHANNEL=nightly
</code></pre></div>



<a name="232526283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/error%20building%20RLS/near/232526283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/error.20building.20RLS.html#232526283">(Mar 31 2021 at 02:18)</a>:</h4>
<p>Also, how do I run RLS with <code>--cli</code>? The contributing docs say:</p>
<blockquote>
<p>You need to run it in the root directory of the project to be analyzed with the <code>--cli</code> flag, e.g., <code>cargo run -- --cli</code>. </p>
</blockquote>
<p>But how do I <code>cargo run</code> RLS if I'm in the directory of another project? I tried <code>target/debug/rls</code> but that gives linker errors.</p>



<a name="232526313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/error%20building%20RLS/near/232526313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/error.20building.20RLS.html#232526313">(Mar 31 2021 at 02:18)</a>:</h4>
<div class="codehilite"><pre><span></span><code>dyld: Library not loaded: @rpath/librustc_driver-f7f595b4250ac716.dylib
  Referenced from: /Users/user/rls/target/debug/rls
  Reason: image not found
fish: &#39;target/debug/rls&#39; terminated by signal SIGABRT (Abort)
</code></pre></div>



<a name="232528919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/error%20building%20RLS/near/232528919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/error.20building.20RLS.html#232528919">(Mar 31 2021 at 02:58)</a>:</h4>
<p>You can use <code>--manifest-path /path/to/rls/Cargo.toml</code> to run from a different directory.</p>



<a name="232529118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/error%20building%20RLS/near/232529118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/error.20building.20RLS.html#232529118">(Mar 31 2021 at 03:01)</a>:</h4>
<p>I saw that online, but I thought it was for something else. Thanks!</p>



<a name="232529187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/error%20building%20RLS/near/232529187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/error.20building.20RLS.html#232529187">(Mar 31 2021 at 03:02)</a>:</h4>
<p>By the way, do you know why it can't load the libraries when I use <code>target/&lt;debug|release&gt;/rls</code>, but it works fine with <code>cargo run</code>? Is Cargo using some magic to tell it where the sysroot is?</p>



<a name="232529752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/error%20building%20RLS/near/232529752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/error.20building.20RLS.html#232529752">(Mar 31 2021 at 03:11)</a>:</h4>
<p>Cargo is setting LD_LIBRARY_PATH (rustup does the same when running the real rls).  You can set it with something like <code>LD_LIBRARY_PATH=$(rustc --print=sysroot)/lib</code>.</p>



<a name="232530571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/error%20building%20RLS/near/232530571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/error.20building.20RLS.html#232530571">(Mar 31 2021 at 03:25)</a>:</h4>
<p>Thanks!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>